glestfandomcom-20200213-history
GAE/Enhancements
Enhancements are a reoccurring element in GAE which are used in custom leveling, upgrades, effects, and emanations. They can be used to increase the abilities and stats of a unit. There are a few ways to do so. Static modifiers and multipliers Static multipliers add a certain absolute value to the stat. Multipliers multiply the stat by a number (thus allowing you to, for example, increase the HP of units by 10% by multiplying it by 1.1). If both a static modifier and a multiplier are used, the multiplier takes effect first. Point boosts Analysis These tags represent very core data structures that drive many aspects of GAE's design. They are used for custom leveling, upgrades, effects, and emanations. On the implementation level, static modifiers are implemented in the C++ UnitStats class and multipliers are implemented in the EnhancementType class (a subclass of UnitStats). Because multiples of these may be applied to a unit, it's important to understand how they are valuated. Put briefly, multipliers are not multiplied against any other bonus, static modifier or multiplier, only against the base stat. For the long explanation, the static modifiers and multipliers for every unit's level-ups, upgrades, effects and emanations are evaluated in the C++ member function Unit::recalculateStats(). All multipliers for a given stat are added together, rather than multiplied, and then the count minus one is subtracted. \text{Total Multiplier} = \text{Multipler}_1 + \text{Multiplier}_2 + \text{Multiplier}_n \text{...} - (\text{Multiplier Count} - 1) Don't use negative values for multipliers, to apply a penalty set the multiplier to a number less than one, but still positive. For example, halves a units sight. The final multiplier is applied to the base stat only, and then static modifiers are added to that result. \text{New value} = \text{Old value} \times \text{Total multiplier} + \text{Total static modifier} Example one A unit with max-hp 1000 is affected by two enhancements, the first has a max-hp multiplier of 1.5 and the second has a max-hp multiplier of 1.3, with these enhancements the unit's current max-hp is, \text{Total Multiplier} = 1.5 + 1.3 - (2 - 1) \text{Total Multiplier} = 1.8 \text{Max HP} = 1000 \times 1.8 \text{Max HP} = 1800 If multipliers were multiplied by each other, the total multiplier would be 1.95 ( 1.3 x\times 1.5 ) and successive multiplier bonuses or penalties would have an exponential effect, the 'multiplier adding' strategy outlined above avoids this problem. Example two If you have a unit with 500 max-hp (base stat), and it gets a static-modifier bonus of +50 and a multiplier bonus of * 1.5, this would look like: \text{Max HP} = 500 \times 1.5 + 50 \text{Max HP} = 800 If static modifier were added to the base stat for the multiplier was applied this would have been 825 ( (500 + 50) \times 1.5 ). This behavior is important to keep in mind when designing mods where very low stats have multipliers applied against them, because the effect will be nominal, despite any static modifier bonuses. Example three A unit with an attack skill of strength 125 has two levels, each providing a 1.2 multiplier to attack-strength, one upgrade affecting the unit provides a static-modifier of +25 to attack-strength. Using this attack skill the strength of an attack will be, \text{Total multiplier} = 1.2 + 1.2 - (2 - 1) \text{Total multiplier} = 1.4 \text{Total static modifier} = +25 \text{Attack strength} = 125 \times 1.4 + 25 \text{Attack strength} = 200 Now, suppose this unit gets struck by a special attack that leaves a detrimental effect on the unit which causes a 0.4 multiplier to attack-strength. The units current attack-strength with this skill is now: \text{Total multiplier} = 1.2 + 1.2 + 0.4 - (3 - 1) \text{Total multiplier} = 0.8 \text{Total static modifier} = +25 \text{Attack strength} = 125 \times 0.8 + 25 \text{Attack strength} = 125 Note: The above example assumes the Effect was applied with 1.0 strength, this strength factor may have been modified by distance from the center of a splash attack (with the flag set). Category:GAE Category:Detailed feature pages